3、制作本地源
(1)安裝本地源制作相關(guān)工具(主服務(wù)器)
[root@master ambari]# yum install yum-utils createrepo yum-plugin-priorities -y
[root@master ambari]# ?createrepo ?./
(2)修改文件里面的源地址(主服務(wù)器)
復(fù)制代碼
[root@master ambari]# vi ambari/centos7/2.6.0.0-267/ambari.repo
#VERSION_NUMBER=2.6.0.0-267
[ambari-2.6.0.0]
name=ambari Version - ambari-2.6.0.0
baseurl=http://192.168.12.101/ambari/ambari/centos7/2.6.0.0-267
gpgcheck=1
gpgkey=http://192.168.12.101/ambari/ambari/centos7/2.6.0.0-267/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1
[root@master ambari]# cp ambari/centos7/2.6.0.0-267/ambari.repo /etc/yum.repos.d/
[root@master ambari]# vi HDP/centos7/2.6.3.0-235/hdp.repo
#VERSION_NUMBER=2.6.3.0-235
[HDP-2.6.3.0]
name=HDP Version - HDP-2.6.3.0
baseurl=http://192.168.12.101/ambari/HDP/centos7/2.6.3.0-235
gpgcheck=1
gpgkey=http://192.168.12.101/ambari/HDP/centos7/2.6.3.0-235/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1
[HDP-UTILS-1.1.0.21]
name=HDP-UTILS Version - HDP-UTILS-1.1.0.21
baseurl=http://192.168.12.101/ambari/HDP-UTILS
gpgcheck=1
gpgkey=http://192.168.12.101/ambari/HDP-UTILS/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1
[root@master ambari]# cp HDP/centos7/2.6.3.0-235/hdp.repo /etc/yum.repos.d/
復(fù)制代碼
上面就創(chuàng)建好了主機(jī)上的文件,然后可以通過(guò)下面命令清楚一下yum的緩存就可以了
[root@master ambari]# yum clean all
[root@master ambari]# yum makecache
[root@master ambari]# yum repolist
(3)將創(chuàng)建好的文件拷貝到子節(jié)點(diǎn)(主服務(wù)器)
復(fù)制代碼
[root@master ambari]#cd /etc/yum.repos.d
[root@master yum.repos.d]# scp ambari.repo slave1:/etc/yum.repos.d/
ambari.repo ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?100% ?274 ? ?16.3KB/s ? 00:00 ? ?
[root@master yum.repos.d]# scp ambari.repo slave2:/etc/yum.repos.d/
ambari.repo ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?100% ?274 ? 115.7KB/s ? 00:00 ? ?
[root@master yum.repos.d]# scp ambari.repo slave3:/etc/yum.repos.d/
ambari.repo ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?100% ?274 ? 608.9KB/s ? 00:00 ? ?
[root@master yum.repos.d]# scp hdp.repo slave1:/etc/yum.repos.d/
hdp.repo ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 100% ?482 ? ? 1.1MB/s ? 00:00 ? ?
[root@master yum.repos.d]# scp hdp.repo slave2:/etc/yum.repos.d/
hdp.repo ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 100% ?482 ? 969.5KB/s ? 00:00 ? ?
[root@master yum.repos.d]# scp hdp.repo slave3:/etc/yum.repos.d/
hdp.repo
四、安裝ambari-server
經(jīng)過(guò)不斷的安裝,有兩種模式,一種是默認(rèn)postgresql數(shù)據(jù)庫(kù)的安裝方式,這種不推薦生產(chǎn)環(huán)境使用,還有一種方式是使用第三方數(shù)據(jù)庫(kù)的安裝方式,下面介紹兩種安裝模式,根據(jù)個(gè)人需求選擇。建議使用自帶的postgresql來(lái)配置數(shù)據(jù)庫(kù),這樣在后面安裝過(guò)程中不會(huì)出現(xiàn)問(wèn)題,如果使用其它數(shù)據(jù)庫(kù),請(qǐng)參考其它教程來(lái)設(shè)置
1、默認(rèn)安裝方式,使用默認(rèn)數(shù)據(jù)庫(kù)PostgreSQL(不推薦生產(chǎn)環(huán)境使用)(主服務(wù)器)
(1)、安裝和配置ambari-server
復(fù)制代碼
[root@master yum.repos.d]# yum -y install ambari-server
[root@master yum.repos.d]# ambari-server setup
Using python ?/usr/bin/python
Setup ambari-server
Checking SELinux...
SELinux status is 'disabled'
Customize user account for ambari-server daemon [y/n] (n)? n
Adjusting ambari-server permissions and ownership...
Checking firewall status...
Checking JDK...
[1] Oracle JDK 1.8 + Java Cryptography Extension (JCE) Policy Files 8
[2] Oracle JDK 1.7 + Java Cryptography Extension (JCE) Policy Files 7
[3] Custom JDK
==============================================================================
Enter choice (1): 3
WARNING: JDK must be installed on all hosts and JAVA_HOME must be valid on all hosts.
WARNING: JCE Policy files are required for configuring Kerberos security. If you plan to use Kerberos,please make sure JCE Unlimited Strength Jurisdiction Policy Files are valid on all hosts.
Path to JAVA_HOME: /usr/java/jdk1.8.0_161
Validating JDK on Ambari Server...done.
Completing setup...
Configuring database...
Enter advanced database configuration [y/n] (n)? n
Configuring database...
Default properties detected. Using built-in database.
Configuring ambari database...
Checking PostgreSQL...
Running initdb: This may take up to a minute.
Initializing database ... OK
About to start PostgreSQL
Configuring local database...
Configuring PostgreSQL...
Restarting PostgreSQL
Creating schema and user...
done.
Creating tables...
done.
Extracting system views...
ambari-admin-2.6.0.0.267.jar
...........
Adjusting ambari-server permissions and ownership...
Ambari Server 'setup' completed successfully.
復(fù)制代碼
(2)、啟動(dòng)ambari
[root@master ~]# ambari-server start
成功啟動(dòng)后在瀏覽器輸入Ambari地址:
http://192.168.12.101:8080
2、以mysql為數(shù)據(jù)庫(kù)安裝(主服務(wù)器)
(1)安裝mysql數(shù)據(jù)庫(kù)
[root@master ~]# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
[root@master ~]# rpm -ivh mysql-community-release-el7-5.noarch.rpm
[root@master ~]# yum install mysql-community-serve
(2)啟動(dòng)mysql,設(shè)置開(kāi)機(jī)啟動(dòng)
[root@master ~]# service mysqld start
[root@master ~]# vi /etc/rc.local
#添加service mysqld start
(3)登錄進(jìn)mysql,初始化設(shè)置root密碼
復(fù)制代碼
[root@master ~]# mysql -uroot?
設(shè)置登錄密碼
mysql> set password for 'root'@'localhost' = password('yourPassword');
添加遠(yuǎn)程登錄用戶(hù)
mysql> grant all privileges on *.* to 'root'@'%' identified by 'yourPassword';
遠(yuǎn)程登錄
#mysql -uroot -h ip(遠(yuǎn)程的ip地址) -p
[root@master yum.repos.d]# yum -y install ambari-server
復(fù)制代碼
(4)登錄mysql,執(zhí)行下面的語(yǔ)句
復(fù)制代碼
CREATE DATABASE ambari; ?
use ambari; ?
CREATE USER 'ambari'@'%' IDENTIFIED BY 'ambarizk123'; ?
GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'%'; ?
CREATE USER 'ambari'@'localhost' IDENTIFIED BY 'ambarizk123'; ?
GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'localhost'; ?
CREATE USER 'ambari'@'master' IDENTIFIED BY 'ambarizk123'; ?
GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'master'; ?
FLUSH PRIVILEGES; ?
source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql ?
show tables; ?
use mysql; ?
select Host User Password from user where user='ambari'; ?
CREATE DATABASE hive; ?
use hive; ?
CREATE USER 'hive'@'%' IDENTIFIED BY 'hive'; ?
GRANT ALL PRIVILEGES ON *.* TO 'hive'@'%'; ?
CREATE USER 'hive'@'localhost' IDENTIFIED BY 'hive'; ?
GRANT ALL PRIVILEGES ON *.* TO 'hive'@'localhost'; ?
CREATE USER 'hive'@'master' IDENTIFIED BY 'hive'; ?
GRANT ALL PRIVILEGES ON *.* TO 'hive'@'master'; ?
FLUSH PRIVILEGES; ?
CREATE DATABASE oozie; ?
use oozie; ?
CREATE USER 'oozie'@'%' IDENTIFIED BY 'oozie'; ?
GRANT ALL PRIVILEGES ON *.* TO 'oozie'@'%'; ?
CREATE USER 'oozie'@'localhost' IDENTIFIED BY 'oozie'; ?
GRANT ALL PRIVILEGES ON *.* TO 'oozie'@'localhost'; ?
CREATE USER 'oozie'@'master' IDENTIFIED BY 'oozie'; ?
GRANT ALL PRIVILEGES ON *.* TO 'oozie'@'master'; ?
FLUSH PRIVILEGES; ?
復(fù)制代碼
(5)簡(jiǎn)歷mysql與ambari-server的連接
網(wǎng)上下載mysql-connector-java-5.1.40.jar放到root文件下
mkdir /usr/share/java
cp /root/mysql-connector-java-5.1.40.jar /usr/share/java/mysql-connector-java.jar
cp /usr/share/java/mysql-connector-java.jar /var/lib/ambari-server/resources/mysql-jdbc-driver.jar
vi /etc/ambari-server/conf/ambari.properties
添加server.jdbc.driver.path=/usr/share/java/mysql-connector-java.jar
(6)初始化設(shè)置ambari-server并啟動(dòng)
復(fù)制代碼
[root@master ~]# ambari-server setup
下面是配置執(zhí)行流程,按照提示操作
(1) 提示是否自定義設(shè)置。輸入:y
Customize user account for ambari-server daemon [y/n] (n)? y
(2)ambari-server 賬號(hào)。
Enter user account for ambari-server daemon (root):
如果直接回車(chē)就是默認(rèn)選擇root用戶(hù)
如果輸入已經(jīng)創(chuàng)建的用戶(hù)就會(huì)顯示:
Enter user account for ambari-server daemon (root):ambari
Adjusting ambari-server permissions and ownership...
(3)檢查防火墻是否關(guān)閉
Adjusting ambari-server permissions and ownership...
Checking firewall...
WARNING: iptables is running. Confirm the necessary Ambari ports are accessible. Refer to the Ambari documentation for more details on ports.
OK to continue [y/n] (y)?
直接回車(chē)
(4)設(shè)置JDK。輸入:3
Checking JDK...
Do you want to change Oracle JDK [y/n] (n)? y
[1] Oracle JDK 1.8 + Java Cryptography Extension (JCE) Policy Files 8
[2] Oracle JDK 1.7 + Java Cryptography Extension (JCE) Policy Files 7
[3] Custom JDK
==============================================================================
Enter choice (1): 3
如果上面選擇3自定義JDK,則需要設(shè)置JAVA_HOME。輸入:/usr/java/jdk1.8.0_161
WARNING: JDK must be installed on all hosts and JAVA_HOME must be valid on all hosts.
WARNING: JCE Policy files are required for configuring Kerberos security. If you plan to use Kerberos,please make sure JCE Unlimited Strength Jurisdiction Policy Files are valid on all hosts.
Path to JAVA_HOME: /usr/java/jdk1.8.0_131
Validating JDK on Ambari Server...done.
Completing setup...
(5)數(shù)據(jù)庫(kù)配置。選擇:y
Configuring database...
Enter advanced database configuration [y/n] (n)? y
(6)選擇數(shù)據(jù)庫(kù)類(lèi)型。輸入:3
Configuring database...
==============================================================================
Choose one of the following options:
[1] - PostgreSQL (Embedded)
[2] - Oracle
[3] - MySQL
[4] - PostgreSQL
[5] - Microsoft SQL Server (Tech Preview)
[6] - SQL Anywhere
==============================================================================
Enter choice (3): 3
(7)設(shè)置數(shù)據(jù)庫(kù)的具體配置信息,根據(jù)實(shí)際情況輸入,如果和括號(hào)內(nèi)相同,則可以直接回車(chē)。如果想重命名,就輸入。
Hostname (localhost):
Port (3306):
Database name (ambari):
Username (ambari):
Enter Database Password (bigdata):ambarizk123
Re-Enter password: ambarizk123
(8)將Ambari數(shù)據(jù)庫(kù)腳本導(dǎo)入到數(shù)據(jù)庫(kù)
WARNING: Before starting Ambari Server, you must run the following DDL against the database to create the schema: /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql?
Proceed with configuring remote database connection properties [y/n] (y)? ?
[root@master ~]# ambari-server start
復(fù)制代碼
?3、錯(cuò)誤處理
如果出現(xiàn)錯(cuò)誤,請(qǐng)注意查看日志,根據(jù)具體的錯(cuò)誤內(nèi)容進(jìn)行處理,默認(rèn)ambari-server的日志在/var/log/ambari-server/ambari-server.log里面。如果在處理日志的過(guò)程中或者后面安裝的過(guò)程中出現(xiàn)一些莫名的錯(cuò)誤,可以重置的安裝。如果上面進(jìn)行的默認(rèn)數(shù)據(jù)庫(kù)的配置,可以使用下面的代碼重置ambari-server
[root@master ~]# ambari-server stop
[root@master ~]# ambari-server reset
[root@master ~]# ambari-server setup
如果選擇的是第二種方式,就需要先執(zhí)行上面的語(yǔ)句,然后手動(dòng)將mysql里面創(chuàng)建的數(shù)據(jù)庫(kù)進(jìn)行刪除。然后再重新執(zhí)行第二步的操作
復(fù)制代碼
[root@master ~]# mysql -uroot -p
mysql> show databases;
+--------------------+
| Database ? ? ? ? ? |
+--------------------+
| information_schema |
| ambari ? ? ? ? ? ? |
| hive ? ? ? ? ? ? ? |
| oozie ? ? ? ? ? ? ?|
| performance_schema |
+--------------------+
5 rows in set (0.00 sec)
mysql> drop database ambari;
mysql> drop database hive;
mysql> drop database oozie;
復(fù)制代碼
如果在安裝的過(guò)程中出現(xiàn)了錯(cuò)誤,又想重新安裝,可以在ambari-server開(kāi)啟的情況下,執(zhí)行下面的語(yǔ)句來(lái)移除已安裝的包,然后再通過(guò)不同的情況選擇上面兩種方式的一種對(duì)ambari-server進(jìn)行重置
python /usr/lib/python2.6/site-packages/ambari_agent/HostCleanup.py --silent
mongodb安裝
?
?